package ch5;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        double a = in.nextDouble();
        double b = in.nextDouble();
        Oval oval = new Oval(a, b);
        System.out.println("The area of " + oval + " is " + oval.area());
        System.out.println("The perimeterof " + oval + " is " + oval.perimeter());
    }
}

abstract class Shapes {
    protected static final double PI = 3.1415926;

    abstract double area();

    abstract double perimeter();
}

class Oval extends Shapes {
    private double a;
    private double b;

    public Oval(double a, double b) {
        this.a = a;
        this.b = b;
    }

    public Oval() {
        a = 0;
        b = 0;
    }

    @Override
    public double area() {
        return PI * a * b;
    }

    @Override
    public double perimeter() {
        return 2 * PI * Math.sqrt((a * a + b * b) / 2);
    }

    @Override
    public String toString() {
        return "Oval(a:" + a + ",b:" + b + ")";
    }
}
